package com.cuput.partybuilding.loginbundle.presenter;

import android.content.Context;
import android.text.TextUtils;

import com.cuput.partybuilding.publiclibrary.base.BasePresenter;
import com.cuput.partybuilding.publiclibrary.bean.User;

/**
 * Created by wei on 2017-05-08.
 */

public class LoginPresenter extends BasePresenter {
    private Context mContext;

    public LoginPresenter(Context context) {
        super(context);
        mContext = context;
    }

    /**
     * 校验登录是否为空
     * @param user
     * @return
     */
    public boolean isLoginEmpty(User user) {
        if (user == null) {
            return false;
        }

        String userName = user.getPhoneNumber();
        String password = user.getPassword();
        if (TextUtils.isEmpty(userName) || TextUtils.isEmpty(password)) {
            return true;
        } else if (TextUtils.getTrimmedLength(userName) == 0 || TextUtils.getTrimmedLength(password) == 0) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public void subscribe() {

    }
}
